var status = 0;
var typede = 0;
var slot = Array();
var dsa = "";

function start() {
    status = -1;
    action(1, 0, 0)
}

function action(g, e, d) {
    if (g == -1) {
        cm.dispose()
    } else {
        if (g == 0) {
            cm.dispose();
            return
        }
        if (g == 1) {
            status++
        }
        if (status == 0) {
            var a = "";
            a = "#e<#v3991051# #v3991050# #v3991038# #v3991044#-道具删除NPC>#n\r\n#b#h0# #k一旦物品删除就无法找回~~~请慎重!!!\r\n";
            a += "            #L1##b>>>删除装备栏道具<<<#k#l\r\n\r\n";
            a += "            #L2##b>>>删除消耗栏道具<<<#k#l\r\n\r\n";
            a += "            #L3##b>>>删除设置栏道具<<<#k#l\r\n\r\n";
            a += "            #L4##b>>>删除其他栏道具<<<#k#l\r\n\r\n";
            a += "            #L5##b>>>删除特殊栏道具<<<#k#l\r\n\r\n";
            cm.askMenu(a)
        } else {
            if (d == 1) {
                dsd = 100;
                var f = "";
                for (var c = 0; c < 96; c++) {
                    if (cm.getInventory(1).getItem(c) != null) {
                        f += "#L" + cm.getInventory(1).getItem(c).getItemId() + "# #z" + cm.getInventory(1).getItem(c).getItemId() + "# #i" + cm.getInventory(1).getItem(c).getItemId() + ":##l\r\n"
                    }
                    slot.push(c)
                }
                cm.askMenu(dsa + "#b请选择需要删除的道具:\r\n#b" + f)
            } else {
                if (d == 2) {
                    dsd = 400;
                    var f = "";
                    for (var c = 0; c < 96; c++) {
                        if (cm.getInventory(2).getItem(c) != null) {
                            f += "#L" + cm.getInventory(2).getItem(c).getItemId() + "# #z" + cm.getInventory(2).getItem(c).getItemId() + "# #i" + cm.getInventory(2).getItem(c).getItemId() + ":##l\r\n"
                        }
                        slot.push(c)
                    }
                    cm.askMenu(dsa + "#b请选择需要删除的道具:\r\n#b" + f)
                } else {
                    if (d == 3) {
                        dsd = 400;
                        var f = "";
                        for (var c = 0; c < 96; c++) {
                            if (cm.getInventory(3).getItem(c) != null) {
                                f += "#L" + cm.getInventory(3).getItem(c).getItemId() + "# #z" + cm.getInventory(3).getItem(c).getItemId() + "# #i" + cm.getInventory(3).getItem(c).getItemId() + ":##l\r\n"
                            }
                            slot.push(c)
                        }
                        cm.askMenu(dsa + "#b请选择需要删除的道具:\r\n#b" + f)
                    } else {
                        if (d == 4) {
                            dsd = 400;
                            var f = "";
                            for (var c = 0; c < 96; c++) {
                                if (cm.getInventory(4).getItem(c) != null) {
                                    f += "#L" + cm.getInventory(4).getItem(c).getItemId() + "# #z" + cm.getInventory(4).getItem(c).getItemId() + "# #i" + cm.getInventory(4).getItem(c).getItemId() + ":##l\r\n"
                                }
                                slot.push(c)
                            }
                            cm.askMenu(dsa + "#b请选择需要删除的道具:\r\n#b" + f)
                        } else {
                            if (d == 5) {
                                dsd = 400;
                                var f = "";
                                for (var c = 0; c < 96; c++) {
                                    if (cm.getInventory(5).getItem(c) != null) {
                                        f += "#L" + cm.getInventory(5).getItem(c).getItemId() + "# #z" + cm.getInventory(5).getItem(c).getItemId() + "# #i" + cm.getInventory(5).getItem(c).getItemId() + ":##l\r\n"
                                    }
                                    slot.push(c)
                                }
                                cm.askMenu(dsa + "#b请选择需要删除的道具:\r\n#b" + f)
                            } else {
                                if (status == 2) {
                                    itemss = d;
                                    if (dsd == 100) {
                                        var b = cm.getPlayer().getItemQuantity(itemss);
                                        if (cm.getMeso() < 0) {
                                            cm.sendOk("你没有足够的金币,删除道具需要收取手续费50万金币。")
                                        } else {
                                            cm.gainMeso(-500000);
                                            cm.gainItem(itemss, -1);
                                            cm.sendOk(dsa + "我已经将您背包里的 #i" + itemss + ":#从你的背包清理！")
                                        }
                                        status = -1
                                    }
                                    if (dsd == 400) {
                                        var b = cm.getPlayer().getItemQuantity(itemss);
                                        if (cm.getMeso() < 0) {
                                            cm.sendOk("你没有足够的金币,删除道具需要收取手续费50万金币。")
                                        } else {
                                            cm.gainMeso(-500000);
                                            cm.gainItem(itemss, -b);
                                            cm.sendOk(dsa + "我已经将您背包里的 #i" + itemss + ":#从你的背包清理！")
                                        }
                                    }
                                    status = -1
                                } else {
                                    cm.dispose()
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};